var express = require('express');
var router = express.Router();
var db = require('../models/logDao.js');
var log_server = require('../lib/log_server.js')

/* 跳转到首页 */
router.get('/', function (req, res, next) {
  // var originalUrl = req.originalUrl;
  // res.render('module/node/index', {
  //   title: '节点列表',
  //   classes: ['', 'active'],
  //   originalUrl:originalUrl
  // })
  res.render('index', {
      title: '日志分析系统'
  });
});

//显示所有日志
router.get('/status', function (req, res, next) {
  var originalUrl = req.originalUrl;
  //TODO 查询所有日志
  res.render('visitors/status/index', {
      title: '日志分析系统',
      originalUrl:originalUrl,
      param:"所有"
  });
});

router.get('/status/:code', function (req, res, next) {
  var code = req.param('code');
  var originalUrl = req.originalUrl;
  //TODO 根据code查询访问日志
  res.render('visitors/status/index', {
      title: '日志分析系统',
      originalUrl:originalUrl,
      param:code,
  });
});

module.exports = router
